# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=onioff
pkgver=84.34dc309
pkgrel=9
groups=('blackarch' 'blackarch-recon' 'blackarch-recon')
arch=('any')
pkgdesc='An onion url inspector for inspecting deep web links.'
url='https://github.com/k4m4/onioff'
license=('MIT')
depends=('python' 'python-requests' 'python-beautifulsoup4'
         'python-termcolor' 'python-pysocks')
makedepends=('git')
source=("git+https://github.com/k4m4/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" readme.md \
    code-of-conduct.md
  install -Dm 644 license "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm *.md license

  cp -a --no-preserve=ownership * "$pkgdir/usr/share/$pkgname/"

cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

